//package cn.zcy.controller.intercept;
//
//import org.springframework.http.HttpRequest;
//import org.springframework.stereotype.Controller;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//
//@Controller
//public class UserController {
//
//    @PostMapping("login")
//    public String login(HttpSession session, HttpServletRequest request, HttpServletResponse response) throws Exception{
//        String username = request.getParameter("username");
//        String password = request.getParameter("password");
//        if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
//            session.setAttribute("error","没有权限，请登录");
//            return "error";
//        } else {
//            session.setAttribute("username", username);
//            session.setAttribute("password", password);
//            System.out.println("request.getRequestURL().toString()login = " + request.getRequestURL().toString());
//            System.out.println("session.getAttribute(\"url01\").toString() = " + session.getAttribute("url01").toString());
//            response.sendRedirect(session.getAttribute("url01").toString());
//            return "admin";
//        }
//    }
//
//    @GetMapping("login")
//    public String login() {
//        return "login";
//    }
//}
